package Lambda;

import collection.Point;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

/**
 * @Author Justin Parker
 * @Date 2024/7/15 0015 14:27
 * @Version 1.0
 */
public class LambdaDemo01 {
    public static void main(String[] args){
        Point p1 = new Point(10, 20);
        Point p2 = new Point(5, 30);
        List<Point> list =new ArrayList<>();
        list.add(p1);
        list.add(p2);

        Collections.sort(list,((o1, o2) -> o1.getX()-o2.getX()));
        System.out.println(list);
    }
}
